<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>transform-origin</title>
    <style>
        html,
        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin: 0 auto;
            height: 100%;
            width: 100%;
        }

        .outer {
            /**定义子元素水平居中**/
            display: flex;
            justify-content: center;
            width: 100px;
            height: 100px;
            background-color: #6a5acd8c;
            position: relative;
        }

        .inner {
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: #6a5acdeb;
            /* 旋转基点 小球的一半为起始 50px为环绕半径 */
            transform-origin: 50% 50px;
            animation: an-circle 3s ease-in-out infinite;
        }

        .inner:nth-child(2) {
            height: 18px;
            width: 18px;
            animation-delay: .2s;
        }

        .inner:nth-child(3) {
            height: 16px;
            width: 16px;
            animation-delay: .4s;
        }

        .inner:nth-child(4) {
            height: 14px;
            width: 14px;
            animation-delay: .6s;
        }

        @keyframes an-circle {
            0% {
                transform: rotate(0);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    </style>
</head>

<body>
    <div class="outer">
        <div class="inner"></div>
        <div class="inner"></div>
        <div class="inner"></div>
        <div class="inner"></div>
    </div>
</body>

</html>